home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
cplapplt.pxl
< prev
next >
Wrap
Text File
|
2001-03-25
|
7KB
|
256 lines
{ Filename : CPLapplets.pxl
Purpose : Windows shell and applets
Date : 20 sep 99
Author : S.Dibbs, VYSOR Integration Inc
History:
Version : 1.0 RELEASE
Update :
Date :
--------------------------------------------------------------------------}
Initialize: {only one instance allowed}
UseCoordinates(PIXEL)
Title$ = "PiXCL 5.0 and the Control Panel Applets"
WinExist(Title$,Res)
If Res = 0 Then Goto One_Instance
Beep
WinSetActive(Title$,Res)
WinShow(Title$,RESTORE,Res)
End
One_Instance:
UseCaption(Title$) {change the title}
WinLocate(Title$,472,188,970,594,Res)
UseBackground(TRANSPARENT,0,128,128)
WinShow(Title$,NOTOPMOST,Res)
DrawBackGround
DirGet(SourceDir$) {used later for library function calls}
DirGetWindows(WinDir$)
DirGetSystem(WinSys$)
WinVersion(Major,Minor,Build,Pack$)
DrawText(10,40,"Windows version detected ...")
DrawNumber(10,60, Major)
DrawNumber(30,60, Minor)
DrawNumber(60,60, Build)
DrawText(100,60,Pack$)
If Build <> 950
If Build <> 2222
WinDir$ = WinSys$
Endif
Endif
If Major = 5 Then WinDir$ = WinSys$ { Windows 2000}
InfoMenu(REMOVE)
WaitInput(100)
SetMenu("&File",IGNORE,
"&New",CreatingFile,
"&Test Applets",OpeningFile,
"&Format Floppy",FormatFloppy,
SEPARATOR,
"E&xit!",Terminate,
ENDPOPUP,
"&View",IGNORE,
"&ToolBar",ViewToolBar,
"&StatusBar",ViewStatusBar,
ENDPOPUP,
"&Information",IGNORE,
"&Concept",Concept,
"&Help",ShowAppHelp,
SEPARATOR,
"&About",About,
ENDPOPUP)
GoSub MakeToolbar
ChangeMenuItem("&ToolBar",CHECK,TBRes)
StatusWindow(ENABLE,BOTTOM,2,500,-1,0,0)
DrawStatusWinText(0,"Ready")
ChangeMenuItem("&StatusBar",CHECK,SBRes)
PiXCLInstDir$ = ""
Wait_for_Input:
WaitInput()
Terminate:
WinHelp("PiXCL Help v4.4" ,QUIT,"")
End
Concept:
MessageBox(OK,1,INFORMATION,
"This sample file opens the various control panel applet files
located in the Windows system directory, and demonstrates the
functions available within the applet.",
Title$,Res)
Goto Wait_for_Input
ShowAppHelp:
{An application Help file usually has the same name as the application. Here,
we get the help topic in the PiXCL help file. The PiXCL install directory is
stored in the Registry.}
If PiXCLInstDir$ = ""
RDBOpenKey(@RDB_CURRENT_USER,
"Software\VYSOR Integration Inc\PiXCL MDI Editor\Settings",OutHandle1)
RDBQueryValue(OutHandle1,"InstDir",PiXCLInstDir$ ,Res)
RDBCloseKey(OutHandle1,Res)
Endif
HelpFile$ = PiXCLInstDir$ + "\pixclhlp.hlp"
WinHelp(HelpFile$,KEY,"Using the Windows Shell functions with PiXCL")
Goto Wait_for_Input
About:
AboutUser(Title$,
"Identifying the Control Panel Applets.",
"Selects a Control Panel applet and check the contents by running a
Windows shell command.")
Goto Wait_for_Input
ViewToolBar:
GetMenuStatus("&ToolBar",CHECKED,Res)
If Res = 0
GoSub MakeToolbar
ChangeMenuItem("&ToolBar",CHECK,Res)
Else
Toolbar()
ChangeMenuItem("&ToolBar",UNCHECK,Res)
Endif
Goto Wait_for_Input
ViewStatusBar:
GetMenuStatus("&StatusBar",CHECKED, Res)
If Res = 0
StatusWindow(ENABLE,BOTTOM,2,500,-1,0,0)
DrawStatusWinText(0,"Ready")
ChangeMenuItem("&StatusBar",CHECK,Res)
Else
StatusWindow(DISABLE,BOTTOM,2,500,-1,0,0)
ChangeMenuItem("&StatusBar",UNCHECK,Res)
Endif
Goto Wait_for_Input
CreatingFile:
{TODO: add file handling here
MessageBox(OK,1,EXCLAMATION,
"Look at the source code, at label 'CreatingFile:'",
"No function coded for this button",Res) }
Cmd$ = "c:\windows\rundll32.exe amovie.ocx,RunDll /play /close /center HVSCmp.avi "
Run(Cmd$)
Goto Wait_for_Input
OpeningFile:
WaitInput(1)
Filter$ = "Control Panel Applets (*.cpl),*.cpl"
InitFile$ = "*.cpl"
Label$ = "Select a Control Panel Applet file to examine."
FileGet(Filter$,InitFile$,WinSys$,Label$,CHANGEDIR,CPLfile$)
If CPLfile$ = "" Then Goto Wait_for_Input
{Loop through the CPL file arguments and see what these applets do}
Ansi("0",Index)
Cmd$ = WinDir$ + "\rundll32.exe shell32.dll,Control_RunDLL "
Cmd$ = Cmd$ + CPLfile$ + ",@"
Chr(Index,App$)
CmdLine$ = Cmd$ + App$
{CmdLine$ = CmdLine$ + ",0" {add extra to select property page}}
RightOf(CmdLine$,50,Rpt$)
DrawStatusWinText(0,Rpt$)
WaitInput(100)
DebugMsgBox(CmdLine$)
Run(CmdLine$)
Loop:
MessageBox(YESNO,1,QUESTION,
"Get next applet ? If no new applet dialog appears, click No",CPLfile$,Res)
If Res = 2 Then DrawStatusWinText(0,"Ready") Goto Wait_for_Input
WaitInput(100)
Index++
Chr(Index,App$)
CmdLine$ = Cmd$ + App$
{CmdLine$ = Cmd$ + "0," + App$ } {add extra to select property page}
RightOf(CmdLine$,50,Rpt$)
DrawStatusWinText(0,Rpt$)
WaitInput(100)
{DebugMsgBox(CmdLine$)}
Run(CmdLine$)
Goto Loop
FormatFloppy:
WaitInput(1)
Cmd$ = WinDir$ + "\rundll32.exe shell32.dll,SHFormatDrive"
Run(Cmd$)
{This displays a modeless dialog that accepts input, and PiXCL will
go back to the idle loop unless code, such as below, is used.}
{
FormatWin$ = "Format - 3╜ Floppy (A:)"
WinExist(FormatWin$,Res)
If Res = 1
While Res = 1
WinExist(FormatWin$,Res)
EndWhile
Endif
}
Goto Wait_for_Input
OpenWithDlg:
WaitInput(1)
Cmd$ = WinDir$ + "\rundll32.exe shell32.dll,OpenAs_RunDLL c:\temp\bob.ump"
Run(Cmd$)
{ NOTES:
If file type *.ump is unknown, an edit control appears into which you can type
a description. If the file type is known (ie an entry in the Registry), the Description
control does not appear.
}
Goto Wait_for_Input
ShowControlPanel:
WaitInput(1)
Cmd$ = WinDir$ + "\rundll32.exe shell32.dll,Control_RunDLL" {show the control panel}
Cmd$ = WinDir$ + "\control.exe"
Run(Cmd$)
Goto Wait_for_Input
{--- Style Suggestion: place all subroutines at the end of the script.}
MakeToolbar: {subroutine}
Toolbar(RAISED, PXL_LARGE,
NULL, NULL, SEPARATOR, "", Wait_for_Input,
PXL_NEW, ENABLED, STD, "FileNew", CreatingFile,
PXL_OPEN, ENABLED, STD, "Test Applets", OpeningFile,
PXL_SAVE, ENABLED, STD, "Format Floppy", FormatFloppy,
PXL_PROP, ENABLED, STD,"''Open With'' Dialog", OpenWithDlg,
PXL_ADDTOFAVORITES, ENABLED, STD,"Display Control Panel",ShowControlPanel,
NULL, NULL, SEPARATOR, "", Wait_for_Input,
HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp)
Return
{ ============================================================
Notes on using rundll32.exe
rundll32.exe <dllname>,<entrypoint> <optional arguments>
<dllname> is not case sensitive, because its a filename. Is usually a DLL, but can also be
an EXE file.
,<entrypoint> This IS case-sensitive. Note that there is no space before or after the comma. Put
in a space and the command will fail.
<optional arguments>
filenames and other arguments
Examples:
amovie.ocx,RunDll c:\windows\clock.avi /play /close
}